package com.zjc.springboot.nettyclient;

import com.zjc.springboot.nettyclient.client.NettyClient;
import com.zjc.springboot.nettyclient.task.TerminalSendGpsThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;

@SpringBootApplication
public class NettyClientMain implements CommandLineRunner {

    @Autowired
    NettyClient nettyClient;

    TerminalSendGpsThread terminalSendGpsThread;

    public static void main(String[] args) {

        new SpringApplicationBuilder(NettyClientMain.class)
                .web(WebApplicationType.NONE)
                .run(args);
    }

    @Override
    public void run(String... args) {
        terminalSendGpsThread = new TerminalSendGpsThread(nettyClient);
        terminalSendGpsThread.start();
    }
}
